package com.yuanqi.dz.dc.util;


import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import pnbclient.helper.StringHelper;
import pnbclient.util.PnbLogFactory;
import pnblog.PnbLogging;


import com.yuanqitech.powermop.dz.DZInfo;
import com.yuanqitech.powermop.dz.DZInfoArray;

public class ReadLocalDZFile {
	public static final PnbLogging LOG = PnbLogFactory.getLogger("DZ_EXT_LOG");
    
	
	
	public static void main(String[] args) {
		File file = new File("D:\\payy\\CMB82142018062400720171101.txt");
		new ReadLocalDZFile().ReadFile(file, "821420180624008", "20171101");
	}
	
	public   DZInfoArray  ReadFile(File file,String  mercharnum,String dzDate){
		DZInfoArray  dzInfoArray=new DZInfoArray();
		String is_filter=DZConfigRead.getProperties("is_filter");
		String  is_private=DZConfigRead.getProperties("is_private");
		String charset=null;
		String start_row_s=null;
		if(null!=is_private && "0".equals(is_private)){
			String  is_private_mercharnum=DZConfigRead.getProperties("is_private_"+mercharnum);
			if(null!=is_private_mercharnum && is_private_mercharnum.equals("1")){
				charset=DZConfigRead.getProperties("charset_"+mercharnum);
				start_row_s=DZConfigRead.getProperties("start_row_"+mercharnum);
			}else{
				charset=DZConfigRead.getProperties("charset");
				start_row_s=DZConfigRead.getProperties("start_row");
			}
		}else{
			charset=DZConfigRead.getProperties("charset_"+mercharnum);
			start_row_s=DZConfigRead.getProperties("start_row_"+mercharnum);
		}
		if(file.exists()){
			BufferedReader reader=null;
			List<DZInfo> list=new ArrayList<DZInfo>();
			try {
				reader =pnbclient.helper.StringHelper.isEmpty(charset) ? new BufferedReader(new FileReader(file))
				: new BufferedReader(new InputStreamReader(new FileInputStream(file), Charset
						.forName(charset)));
				String lineText = null;
				int  start_row=StringHelper.isEmpty(start_row_s)?1:Integer.valueOf(start_row_s);
				int  n=1;
				Map<String, int[]> map=getIndexs(mercharnum);
				int[]  TermIdIndex=map.get("TermIdIndex");
				int[]  BankNameIndex =map.get("BankNameIndex");
				int[] TranCardNumIndex=map.get("TranCardNumIndex");
				int[] TrDateTimeIndex= map.get("TrDateTimeIndex");
				int[]  msgtypeIndex =map.get("msgtypeIndex");
				int[]  proccodeIndex=map.get("proccodeIndex");
				int[]  svr_codeIndex=map.get("svr_codeIndex");
				int[] AmountIndex=map.get("AmountIndex");
				int[] ReferNumIndex=map.get("ReferNumIndex");
				int[]  PayFlowNOIndex=map.get("PayFlowNOIndex");
				int[]  HisOperatorIndex=map.get("HisOperatorIndex");
				int[]  PatientIDIndex=map.get("PatientIDIndex");
				int[] PatientNameIndex=map.get("PatientNameIndex");
				int[]  ext1Index=map.get("ext1Index");
				int[]  ext2Index=map.get("ext2Index");
				int[]  ext3Index=map.get("ext3Index");
				int[]  ext4Index=map.get("ext4Index");
				int[]  ext5Index=map.get("ext5Index");
				int[]  ext6Index=map.get("ext6Index");
				int[]  MercharnumIndex=map.get("MercharnumIndex");

				while ((lineText = reader.readLine()) != null ) {
					if(n>=start_row && !StringHelper.isEmpty(lineText)){
						DZInfo  dzinfo=new DZInfo();
						String merchant_num=null;
						if(null!=MercharnumIndex && MercharnumIndex.length==2){
							merchant_num=StringUtilDz.getIsNull(  lineText.substring(MercharnumIndex[0], MercharnumIndex[1]));
						}
						if(null!=is_filter && "1".equals(is_filter)){
							//过滤商户号
							if(mercharnum.equals(merchant_num)){
								dzinfo.setMerchantNum(merchant_num);
								//终端号
								String  TermId=null;
								if(null!=TermIdIndex && TermIdIndex.length==2){
									TermId=StringUtilDz.getIsNull( lineText.substring(TermIdIndex[0], TermIdIndex[1]) );
								}
								dzinfo.setTermId(TermId);

								//发卡行
								String BankName=null;
								if(null!=BankNameIndex && BankNameIndex.length==2){
									BankName=StringUtilDz.getIsNull( lineText.substring(BankNameIndex[0], BankNameIndex[1]) );
								}
								dzinfo.setBankName(BankName);

								//卡号
								String  TranCardNum=null;
								if(null!=TranCardNumIndex && TranCardNumIndex.length==2){
									TranCardNum=StringUtilDz.getIsNull( lineText.substring(TranCardNumIndex[0], TranCardNumIndex[1]) );
								} 
								dzinfo.setTranCardNum(TranCardNum);

								//交易时间
								String  TrDateTime=null;
								if(null!=TrDateTimeIndex && TrDateTimeIndex.length==2){
									TrDateTime=StringUtilDz.getIsNull(  lineText.substring(TrDateTimeIndex[0], TrDateTimeIndex[1]));
									String time= dzDate+TrDateTime.substring(4,TrDateTime.length());	
									time=DateUtil.stringFormat(time,"yyyyMMddHHmmss","yyyy-MM-dd HH:mm:ss");
									dzinfo.setTrDateTime(time);
								}

								//交易类型
								String  TranCode=null;
								if(null!=msgtypeIndex && msgtypeIndex.length==2 &&  null!=proccodeIndex && proccodeIndex.length==2 && null!=svr_codeIndex && svr_codeIndex.length==2){
									String msgtype=StringUtilDz.getIsNull(  lineText.substring(msgtypeIndex[0], msgtypeIndex[1]) );
									String proccode=StringUtilDz.getIsNull( lineText.substring(proccodeIndex[0], proccodeIndex[1]));
									String svr_code=StringUtilDz.getIsNull( lineText.substring(svr_codeIndex[0], svr_codeIndex[1]) );
									if(!StringHelper.isEmpty(msgtype)  && !StringHelper.isEmpty(proccode) &&  !StringHelper.isEmpty(svr_code)){
										TranCode=msgtype.substring(0,3)+proccode.substring(0,2)+svr_code;
									}
									if("0200000".equals(TranCode)){
										TranCode="S1";
									}else if("0202000".equals(TranCode) || "0420000".equals(TranCode)){
										TranCode="S2";
									}else if("0222000".equals(TranCode)){
										TranCode="S3";
									}else if("0203000".equals(TranCode)){
										continue;
									}else{
										LOG.addDebug("不识别的交易类型码:"+TranCode);
										TranCode="";
									}
								}
								dzinfo.setTranCode(TranCode);

								//交易金额
								Float f=null;
								if(null!=AmountIndex && AmountIndex.length==2){
									String amount=   lineText.substring(AmountIndex[0], AmountIndex[1]);
									f=Float.valueOf(amount)/100;
								}
								dzinfo.setAmount(f);

								//检索参考号
								String ReferNum=null;
								if(null!=ReferNumIndex && ReferNumIndex.length==2){
									ReferNum=StringUtilDz.getIsNull(lineText).substring(ReferNumIndex[0], ReferNumIndex[1]);
								}
								dzinfo.setReferNum(ReferNum);

								//操作员
								String PayFlowNO=null;
								if(null!=PayFlowNOIndex && PayFlowNOIndex.length==2){
									PayFlowNO=StringUtilDz.getIsNull(lineText.substring(PayFlowNOIndex[0], PayFlowNOIndex[1]));
								}
								dzinfo.setPayFlowNO(PayFlowNO);

								//HIS交易流水
								String HisOperator=null;
								if(null!=HisOperatorIndex && HisOperatorIndex.length==2 ){
									HisOperator=StringUtilDz.getIsNull(lineText).substring(HisOperatorIndex[0], HisOperatorIndex[1]);
								}
								dzinfo.setHisOperator(HisOperator);

								//患者姓名
								String PatientID=null;
								if(null!=PatientIDIndex && PatientIDIndex.length==2){
									PatientID=StringUtilDz.getIsNull(lineText.substring(PatientIDIndex[0], PatientIDIndex[1]));
								}
								dzinfo.setPatientID(PatientID);

								//患者姓名
								String  PatientName=null;
								if(null!=PatientNameIndex && PatientNameIndex.length==2){
									PatientName=StringUtilDz.getIsNull(lineText.substring(PatientNameIndex[0], PatientNameIndex[1]));
								}
								dzinfo.setPatientName(PatientName);

								//ext1
								String ext1=null;
								if(null!=ext1Index && ext1Index.length==2){
									ext1 =StringUtilDz.getIsNull(lineText.substring(ext1Index[0], ext1Index[1]));
								}
								dzinfo.setExt1(ext1);

								//ext2
								String ext2=null;
								if(null!=ext2Index && ext2Index.length==2){
									ext2 =StringUtilDz.getIsNull(lineText.substring(ext2Index[0], ext2Index[1]));
								}
								dzinfo.setExt2(ext2);

								//ext3
								String ext3=null;
								if(null!=ext3Index && ext3Index.length==2){
									ext3 =StringUtilDz.getIsNull(lineText.substring(ext3Index[0], ext3Index[1]));
								}
								dzinfo.setExt3(ext3);

								//ext4
								String ext4=null;
								if(null!=ext4Index && ext4Index.length==2){
									ext4 =StringUtilDz.getIsNull(lineText.substring(ext4Index[0], ext4Index[1]));
								}
								dzinfo.setExt4(ext4);

								//ext5
								String ext5=null;
								if(null!=ext5Index && ext5Index.length==2){
									ext5 =StringUtilDz.getIsNull(lineText.substring(ext5Index[0], ext5Index[1]));
								}
								dzinfo.setExt5(ext5);

								//ext6
								String ext6=null;
								if(null!=ext6Index && ext6Index.length==2){
									ext6 =StringUtilDz.getIsNull(lineText.substring(ext6Index[0], ext6Index[1]));
								}
								dzinfo.setExt6(ext6);
								list.add(dzinfo);

							}   
						}else{

							//不需要过滤商户号的情况
							//商户号
							dzinfo.setMerchantNum(merchant_num);

							//终端号
							String  TermId=null;
							if(null!=TermIdIndex && TermIdIndex.length==2){
								TermId=StringUtilDz.getIsNull( lineText.substring(TermIdIndex[0], TermIdIndex[1]) );
							}
							dzinfo.setTermId(TermId);
							//发卡行
							String BankName=null;
							if(null!=BankNameIndex && BankNameIndex.length==2){
								BankName=StringUtilDz.getIsNull( lineText.substring(BankNameIndex[0], BankNameIndex[1]) );
							}
							dzinfo.setBankName(BankName);

							//卡号
							String  TranCardNum=null;
							if(null!=TranCardNumIndex && TranCardNumIndex.length==2){
								TranCardNum=StringUtilDz.getIsNull( lineText.substring(TranCardNumIndex[0], TranCardNumIndex[1]) );
							} 
							dzinfo.setTranCardNum(TranCardNum);

							//交易时间
							String  TrDateTime=null;
							String time = "";
							if(null!=TrDateTimeIndex && TrDateTimeIndex.length==2){
								TrDateTime=StringUtilDz.getIsNull(  lineText.substring(TrDateTimeIndex[0], TrDateTimeIndex[1]));
								 time= dzDate+TrDateTime.substring(4,TrDateTime.length());	
								time=DateUtil.stringFormat(time,"yyyyMMddHHmmss","yyyy-MM-dd HH:mm:ss");
							}
							dzinfo.setTrDateTime(time);

							//交易类型
							String  TranCode=null;
							if("S3".equalsIgnoreCase(TranCode)){
								TranCode="S3";
							}else{

								if(null!=msgtypeIndex && msgtypeIndex.length==2 &&  null!=proccodeIndex && proccodeIndex.length==2 && null!=svr_codeIndex && svr_codeIndex.length==2){
									String msgtype=StringUtilDz.getIsNull(  lineText.substring(msgtypeIndex[0], msgtypeIndex[1]) );
									String proccode=StringUtilDz.getIsNull( lineText.substring(proccodeIndex[0], proccodeIndex[1]));
									String svr_code=StringUtilDz.getIsNull( lineText.substring(svr_codeIndex[0], svr_codeIndex[1]) );
									if(!StringHelper.isEmpty(msgtype)  && !StringHelper.isEmpty(proccode) &&  !StringHelper.isEmpty(svr_code)){
										TranCode=msgtype.substring(0,3)+proccode.substring(0,2)+svr_code;
									}
									if("0200000".equals(TranCode)){
										TranCode="S1";
									}else if("0202000".equals(TranCode) || "0420000".equals(TranCode)){
										TranCode="S2";
									}else if("0222000".equals(TranCode)){
										TranCode="S3";
									}else if("0203000".equals(TranCode)){
										continue;
									}else{
										LOG.addDebug("不识别的交易类型码:"+TranCode);
										TranCode="";
									}
								}
							}

							dzinfo.setTranCode(TranCode);

							//交易金额
							Float f=null;
							if(null!=AmountIndex && AmountIndex.length==2){
								String amount=   lineText.substring(AmountIndex[0], AmountIndex[1]);
								f=Float.valueOf(amount)/100;
							}
							dzinfo.setAmount(f);

							//检索参考号
							String ReferNum=null;
							if(null!=ReferNumIndex && ReferNumIndex.length==2){
								ReferNum=StringUtilDz.getIsNull(lineText).substring(ReferNumIndex[0], ReferNumIndex[1]);
							}
							dzinfo.setReferNum(ReferNum);

							//操作员
							String PayFlowNO=null;
							if(null!=PayFlowNOIndex && PayFlowNOIndex.length==2){
								PayFlowNO=StringUtilDz.getIsNull(lineText.substring(PayFlowNOIndex[0], PayFlowNOIndex[1]));
							}
							dzinfo.setPayFlowNO(PayFlowNO);

							//HIS交易流水
							String HisOperator=null;
							if(null!=HisOperatorIndex && HisOperatorIndex.length==2 ){
								HisOperator=StringUtilDz.getIsNull(lineText).substring(HisOperatorIndex[0], HisOperatorIndex[1]);
							}
							dzinfo.setHisOperator(HisOperator);

							//患者姓名
							String PatientID=null;
							if(null!=PatientIDIndex && PatientIDIndex.length==2){
								PatientID=StringUtilDz.getIsNull(lineText.substring(PatientIDIndex[0], PatientIDIndex[1]));
							}
							dzinfo.setPatientID(PatientID);

							//患者姓名
							String  PatientName=null;
							if(null!=PatientNameIndex && PatientNameIndex.length==2){
								PatientName=StringUtilDz.getIsNull(lineText.substring(PatientNameIndex[0], PatientNameIndex[1]));
							}
							dzinfo.setPatientName(PatientName);

							//ext1
							String ext1=null;
							if(null!=ext1Index && ext1Index.length==2){
								ext1 =StringUtilDz.getIsNull(lineText.substring(ext1Index[0], ext1Index[1]));
							}
							dzinfo.setExt1(ext1);

							//ext2
							String ext2=null;
							if(null!=ext2Index && ext2Index.length==2){
								ext2 =StringUtilDz.getIsNull(lineText.substring(ext2Index[0], ext2Index[1]));
							}
							dzinfo.setExt2(ext2);

							//ext3
							String ext3=null;
							if(null!=ext3Index && ext3Index.length==2){
								ext3 =StringUtilDz.getIsNull(lineText.substring(ext3Index[0], ext3Index[1]));
							}
							dzinfo.setExt3(ext3);

							//ext4
							String ext4=null;
							if(null!=ext4Index && ext4Index.length==2){
								ext4 =StringUtilDz.getIsNull(lineText.substring(ext4Index[0], ext4Index[1]));
							}
							dzinfo.setExt4(ext4);

							//ext5
							String ext5=null;
							if(null!=ext5Index && ext5Index.length==2){
								ext5 =StringUtilDz.getIsNull(lineText.substring(ext5Index[0], ext5Index[1]));
							}
							dzinfo.setExt5(ext5);

							//ext6
							String ext6=null;
							if(null!=ext6Index && ext6Index.length==2){
								ext6 =StringUtilDz.getIsNull(lineText.substring(ext6Index[0], ext6Index[1]));
							}
							dzinfo.setExt6(ext6);
							list.add(dzinfo);
						}
					}
					n++;
				}
				if(null!=list && list.size()>0){
					DZInfo[] dzInfos=new DZInfo[list.size()];
					for (int i = 0; i < list.size(); i++) {
						dzInfos[i]=list.get(i);
					}
					dzInfoArray.setDzInfo(dzInfos);
					dzInfoArray.setRc("1");
					dzInfoArray.setErrormsg("获取对账数据成功");
				}else{ 
					dzInfoArray.setRc("-1");
					dzInfoArray.setDzInfo(new DZInfo[0]);
					dzInfoArray.setErrormsg("获取对账数据为空");
				}

			} catch (FileNotFoundException e) {
				dzInfoArray.setRc("-1");
				dzInfoArray.setDzInfo(new DZInfo[0]);
				dzInfoArray.setErrormsg("获取对账数据FileNotFound异常");
				LOG.addError("获取对账数据FileNotFound异常"+e);
				return dzInfoArray;

			} catch (IOException e) {
				dzInfoArray.setRc("-1");
				dzInfoArray.setDzInfo(new DZInfo[0]);
				dzInfoArray.setErrormsg("获取对账数据io异常");
				LOG.addError("获取对账数据io异常"+e);
				return dzInfoArray;
			}

		}else{
			dzInfoArray.setRc("-1");
			dzInfoArray.setErrormsg(file.getName()+"不存在");
			LOG.addError(file.getName()+"不存在02");
			return dzInfoArray;

		}
		return dzInfoArray;
	}
	



	public static  Map<String, int[]>  getIndexs(String mercharnum){
		Map<String, int[]> map=new HashMap<String, int[]>();
		String  is_private=DZConfigRead.getProperties("is_private");

		if(null!=is_private && "0".equals(is_private)){
			String  is_private_mercharnum=DZConfigRead.getProperties("is_private_"+mercharnum);
			if(null!=is_private_mercharnum && is_private_mercharnum.equals("1")){
				int[]  TermIdIndex=DZConfigRead.getProperties2("TermId_"+mercharnum);
				int[]  BankNameIndex =DZConfigRead.getProperties2("BankName_"+mercharnum);
				int[] TranCardNumIndex=DZConfigRead.getProperties2("TranCardNum_"+mercharnum);
				int[] TrDateTimeIndex= DZConfigRead.getProperties2("TrDateTime_"+mercharnum);
				int[]  msgtypeIndex =DZConfigRead.getProperties2("msgtype_"+mercharnum);
				int[]  proccodeIndex=DZConfigRead.getProperties2("proccode_"+mercharnum);
				int[]  svr_codeIndex=DZConfigRead.getProperties2("svr_code_"+mercharnum);
				int[] AmountIndex=DZConfigRead.getProperties2("Amount_"+mercharnum);
				int[] ReferNumIndex=DZConfigRead.getProperties2("ReferNum_"+mercharnum);
				int[]  PayFlowNOIndex=DZConfigRead.getProperties2("PayFlowNO_"+mercharnum);
				int[]  HisOperatorIndex=DZConfigRead.getProperties2("HisOperator_"+mercharnum);
				int[]  PatientIDIndex=DZConfigRead.getProperties2("PatientID_"+mercharnum);
				int[] PatientNameIndex=DZConfigRead.getProperties2("PatientName_"+mercharnum);
				int[]  ext1Index=DZConfigRead.getProperties2("ext1_"+mercharnum);
				int[]  ext2Index=DZConfigRead.getProperties2("ext2_"+mercharnum);
				int[]  ext3Index=DZConfigRead.getProperties2("ext3_"+mercharnum);
				int[]  ext4Index=DZConfigRead.getProperties2("ext4_"+mercharnum);
				int[]  ext5Index=DZConfigRead.getProperties2("ext5_"+mercharnum);
				int[]  ext6Index=DZConfigRead.getProperties2("ext6_"+mercharnum);
				int[]  MercharnumIndex=DZConfigRead.getProperties2("MerchantNum_"+mercharnum);
				map.put("TermIdIndex", TermIdIndex);
				map.put("BankNameIndex", BankNameIndex);
				map.put("TranCardNumIndex", TranCardNumIndex);
				map.put("TrDateTimeIndex", TrDateTimeIndex);
				map.put("msgtypeIndex", msgtypeIndex);
				map.put("proccodeIndex", proccodeIndex);
				map.put("svr_codeIndex", svr_codeIndex);
				map.put("AmountIndex", AmountIndex);
				map.put("ReferNumIndex", ReferNumIndex);
				map.put("PayFlowNOIndex", PayFlowNOIndex);
				map.put("HisOperatorIndex", HisOperatorIndex);
				map.put("PatientIDIndex", PatientIDIndex);
				map.put("PatientNameIndex", PatientNameIndex);
				map.put("ext1Index", ext1Index);
				map.put("ext2Index", ext2Index);
				map.put("ext3Index", ext3Index);
				map.put("ext4Index", ext4Index);
				map.put("ext5Index", ext5Index);
				map.put("ext6Index", ext6Index);
				map.put("MercharnumIndex", MercharnumIndex);

			}else{
				int[]  TermIdIndex=DZConfigRead.getProperties2("TermId");
				int[]  BankNameIndex =DZConfigRead.getProperties2("BankName");
				int[] TranCardNumIndex=DZConfigRead.getProperties2("TranCardNum");
				int[] TrDateTimeIndex= DZConfigRead.getProperties2("TrDateTime");
				int[]  msgtypeIndex =DZConfigRead.getProperties2("msgtype");
				int[]  proccodeIndex=DZConfigRead.getProperties2("proccode");
				int[]  svr_codeIndex=DZConfigRead.getProperties2("svr_code");
				int[] AmountIndex=DZConfigRead.getProperties2("Amount");
				int[] ReferNumIndex=DZConfigRead.getProperties2("ReferNum");
				int[]  PayFlowNOIndex=DZConfigRead.getProperties2("PayFlowNO");
				int[]  HisOperatorIndex=DZConfigRead.getProperties2("HisOperator");
				int[]  PatientIDIndex=DZConfigRead.getProperties2("PatientID");
				int[] PatientNameIndex=DZConfigRead.getProperties2("PatientName");
				int[]  ext1Index=DZConfigRead.getProperties2("ext1");
				int[]  ext2Index=DZConfigRead.getProperties2("ext2");
				int[]  ext3Index=DZConfigRead.getProperties2("ext3");
				int[]  ext4Index=DZConfigRead.getProperties2("ext4");
				int[]  ext5Index=DZConfigRead.getProperties2("ext5");
				int[]  ext6Index=DZConfigRead.getProperties2("ext6");
				int[]  MercharnumIndex=DZConfigRead.getProperties2("MerchantNum");


				map.put("TermIdIndex", TermIdIndex);
				map.put("BankNameIndex", BankNameIndex);
				map.put("TranCardNumIndex", TranCardNumIndex);
				map.put("TrDateTimeIndex", TrDateTimeIndex);
				map.put("msgtypeIndex", msgtypeIndex);
				map.put("proccodeIndex", proccodeIndex);
				map.put("svr_codeIndex", svr_codeIndex);
				map.put("AmountIndex", AmountIndex);
				map.put("ReferNumIndex", ReferNumIndex);
				map.put("PayFlowNOIndex", PayFlowNOIndex);
				map.put("HisOperatorIndex", HisOperatorIndex);
				map.put("PatientIDIndex", PatientIDIndex);
				map.put("PatientNameIndex", PatientNameIndex);
				map.put("ext1Index", ext1Index);
				map.put("ext2Index", ext2Index);
				map.put("ext3Index", ext3Index);
				map.put("ext4Index", ext4Index);
				map.put("ext5Index", ext5Index);
				map.put("ext6Index", ext6Index);
				map.put("MercharnumIndex", MercharnumIndex);

			}

		}else{
			int[]  TermIdIndex=DZConfigRead.getProperties2("TermId_"+mercharnum);
			int[]  BankNameIndex =DZConfigRead.getProperties2("BankName_"+mercharnum);
			int[] TranCardNumIndex=DZConfigRead.getProperties2("TranCardNum_"+mercharnum);
			int[] TrDateTimeIndex= DZConfigRead.getProperties2("TrDateTime_"+mercharnum);
			int[]  msgtypeIndex =DZConfigRead.getProperties2("msgtype_"+mercharnum);
			int[]  proccodeIndex=DZConfigRead.getProperties2("proccode_"+mercharnum);
			int[]  svr_codeIndex=DZConfigRead.getProperties2("svr_code_"+mercharnum);
			int[] AmountIndex=DZConfigRead.getProperties2("Amount_"+mercharnum);
			int[] ReferNumIndex=DZConfigRead.getProperties2("ReferNum_"+mercharnum);
			int[]  PayFlowNOIndex=DZConfigRead.getProperties2("PayFlowNO_"+mercharnum);
			int[]  HisOperatorIndex=DZConfigRead.getProperties2("HisOperator_"+mercharnum);
			int[]  PatientIDIndex=DZConfigRead.getProperties2("PatientID_"+mercharnum);
			int[] PatientNameIndex=DZConfigRead.getProperties2("PatientName_"+mercharnum);
			int[]  ext1Index=DZConfigRead.getProperties2("ext1_"+mercharnum);
			int[]  ext2Index=DZConfigRead.getProperties2("ext2_"+mercharnum);
			int[]  ext3Index=DZConfigRead.getProperties2("ext3_"+mercharnum);
			int[]  ext4Index=DZConfigRead.getProperties2("ext4_"+mercharnum);
			int[]  ext5Index=DZConfigRead.getProperties2("ext5_"+mercharnum);
			int[]  ext6Index=DZConfigRead.getProperties2("ext6_"+mercharnum);
			int[]  MercharnumIndex=DZConfigRead.getProperties2("MerchantNum_"+mercharnum);
			map.put("TermIdIndex", TermIdIndex);
			map.put("BankNameIndex", BankNameIndex);
			map.put("TranCardNumIndex", TranCardNumIndex);
			map.put("TrDateTimeIndex", TrDateTimeIndex);
			map.put("msgtypeIndex", msgtypeIndex);
			map.put("proccodeIndex", proccodeIndex);
			map.put("svr_codeIndex", svr_codeIndex);
			map.put("AmountIndex", AmountIndex);
			map.put("ReferNumIndex", ReferNumIndex);
			map.put("PayFlowNOIndex", PayFlowNOIndex);
			map.put("HisOperatorIndex", HisOperatorIndex);
			map.put("PatientIDIndex", PatientIDIndex);
			map.put("PatientNameIndex", PatientNameIndex);
			map.put("ext1Index", ext1Index);
			map.put("ext2Index", ext2Index);
			map.put("ext3Index", ext3Index);
			map.put("ext4Index", ext4Index);
			map.put("ext5Index", ext5Index);
			map.put("ext6Index", ext6Index);
			map.put("MercharnumIndex", MercharnumIndex);

		}
		return map;
	}

}
